import Vue from "vue";
import VueRouter from "vue-router";
import Login from "../views/login";
import Layout from "@/components/Layout.vue";
import Home from "../views/home";
import User from "../views/user";
import Role from "../views/role";
import School from "../views/students/School.vue";
import Class from "../views/students/Class.vue";
import Majors from "../views/students/Majors.vue";
import Student from "../views/students/Student.vue";
import studentUpdate from "../views/students/studentUpdate.vue"

Vue.use(VueRouter);

const routes = [
  //登录
  {
    path: "/login",
    name: "login",
    component: Login,
  },
  {
    path: "/",
    name: "Layout",
    component: Layout,
    redirect: '/home',
    children: [
      {
        path: "/home",
        component: Home,
        meta: { title:'首页' }
      },
      {
        path: "/user",
        component: User,
        meta: { title:'用户管理' }
      },
      {
        path: "/role",
        component: Role,
        meta: { title:'角色管理' }
      },
      {
        path: "/school",
        component: School,
        meta: { title:'学校管理' }
      },
      {
        path: "/class",
        component: Class,
        meta: { title:'班级管理' }
      },
      {
        path: "/majors",
        component: Majors,
        meta: { title:'专业管理' }
      },
      {
        path: "/student",
        component: Student,
        meta: { title:'学生管理' }
      },
      {
        path: "/student/update/:id",
        component: studentUpdate,
        meta: { title:'学生编辑' }
      },
      
    ],
  },
  
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
